#!/bin/sh

ip=`ifconfig | grep -A10 en0 | grep "inet " | head -1 | awk '{ print $2; }'`
if [ "$ip" == "" ]
then
	ip=`ifconfig | grep -A10 en1 | grep "inet " | head -1 | awk '{ print $2; }'`
fi
if [ "$ip" == "" ]
then
	ip=`ifconfig | grep -A10 vnic0 | grep "inet " | head -1 | awk '{ print $2; }'`
fi
if [ "$ip" != "" ]
then
	cat first.template | sed -e "s/IP/$ip/" > first.conf
	env exabgp.tcp.bind="127.0.0.1" exabgp.tcp.port=1790 ../../../sbin/exabgp first.conf
else
	echo "get some IP somewhere on this machine please"
fi
